package com.koron.order.linedefect.base.mapper;

import com.koron.order.defect.bean.dto.DefectEquipmentDto;
import com.koron.order.defect.bean.dto.SzlsDefectDto;
import com.koron.order.defect.bean.po.DefectRate;
import com.koron.order.linedefect.base.bean.po.DefectBean;
import com.koron.order.linedefect.base.bean.query.DefectEquipmentQuery;
import com.koron.order.linedefect.base.bean.query.DefectQuery;
import com.koron.order.linedefect.base.bean.vo.DefectVO;
import org.apache.ibatis.annotations.Param;

import java.math.BigDecimal;
import java.util.List;

/**
 * @ClassName OrderMapper
 * @description
 * @Author zhouj
 * @Date 2021/9/1 11:26
 */
public interface DefectMapper {

    int insert(DefectBean defectBean);

    int update(DefectBean defectBean);

    int updateBatch(@Param("defectBeans") List<DefectBean> defectBeans);

    int delete(@Param("ids") List<String> list);

    DefectVO queryById(String id);

    List<DefectBean> queryList(DefectQuery defectVo);

    List<DefectVO> queryDefectVoList(DefectQuery query);

    int submitDefect(@Param("orderId") String orderId, @Param("status") String status);

    List<DefectEquipmentDto> queryEquipmentDefectNums(@Param("defectEquipmentQueryList") List<DefectEquipmentQuery> defectEquipmentQueryList);

    List<DefectEquipmentDto> queryEquipmentDefectNumsByIds(@Param("list") List<List<String>> agreementNumberList);

    int deprecatedBatch(@Param("orderIds") List<String> ids_after, @Param("status") String status, @Param("cancelReason") String cancelReason);

    // 数字孪生对外接口查询
    List<SzlsDefectDto> szlsDefectByYear(SzlsDefectDto dto);

    List<DefectRate> getRateOfDefect(@Param("startTime") String startTime, @Param("endTime") String endTime);

    List<DefectRate> getRateImmediateOfDefect(@Param("startTime") String startTime, @Param("endTime") String endTime);

    BigDecimal getDefectRate(@Param("startTime") String startTime, @Param("endTime") String endTime);
    BigDecimal defectRateInTime(@Param("startTime") String startTime, @Param("endTime") String endTime);
}
